package com.shell.provider;

import com.shell.governor.authorization.po.PubRole;
import com.shell.governor.authorization.service.PubRoleService;
import com.shell.governor.modules.po.PubDictionary;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PubRoleProvider {
	@Autowired
	private PubRoleService pubRoleService;

	@RequestMapping({ "/role/selectOne" })
	PubRole selectOne(@RequestBody PubRole role) {
		return (PubRole) this.pubRoleService.selectOne(role);
	}

	@RequestMapping({ "/role/selectRolesByCodes" })
	List<PubRole> selectRolesByCodes(@RequestParam("codes") String codes) {
		return this.pubRoleService.selectRolesByCodes(new String[] { codes });
	}

	@RequestMapping({ "/role/selectUserRole" })
	List<PubRole> selectUserRole(@RequestParam("userId") String userId, @RequestParam("cusId") String cusId) {
		return this.pubRoleService.selectUserRole(userId, cusId);
	}

	@RequestMapping({ "/role/getRoleByDict" })
	List<PubRole> getRoleByDict(@RequestBody PubDictionary dict) {
		return this.pubRoleService.getRoleByDict(dict);
	}
}
